package ETLLOG2;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

/**
 * Created by yqz on 2019/3/30.
 */
public class LogDriver {
    public static void main(String[] args) throws Exception {
        args = new String[]{"F:\\date\\A\\web.txt", "F:\\date\\A\\Andy12121"};

        //1.获取配置信息
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);

        //2.加载反射类
        job.setJarByClass(LogDriver.class);
        job.setMapperClass(LoggerMapper.class);
        //job.setReducerClass();

        //3.map的输出和reduce的输出的类型
        //job.setMapOutputKeyClass();
        //job.setMapOutputValueClass();
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(NullWritable.class);

        //4.输入数据和输出数据的路径
        FileInputFormat.setInputPaths(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));

        //5.job提交
        job.waitForCompletion(true);


    }
}
